package com.bw.controller;

import com.bw.entity.Zhu;
import com.bw.mapper.ZhuMapper;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class ZhuController {


    @Autowired
    ZhuMapper zhuMapper;

    @RequestMapping("/zhuPage.do")
    public String zhuPage(){

        return "zhuPage";
    }


    @RequestMapping("/zhu.do")
    @ResponseBody
    public List<Zhu> zhu(String status){

        List<Zhu> list = zhuMapper.selectZhu(status);

        return list;
    }

    @RequestMapping("/excel.do")
    public void excel(String status, HttpServletResponse response){

        List<Zhu> list = zhuMapper.selectZhu(status);

        ExcelUtils.exportExcel(list,"楼盘统计结果","sheet1",response);
    }
}
